package iot.core.data;

import iot.core.data.mapper.MyBaseMapper;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface IService<  T>    {
    MyBaseMapper<T> getBaseMapper();
    @Transactional(rollbackFor = Exception.class)
    int insert(T entity);
    @Transactional(rollbackFor = Exception.class)
    int update(T entity);
    @Transactional(rollbackFor = Exception.class)
    int delete(T entity);

    @Transactional(rollbackFor = Exception.class)
    int delete(BaseQto entity);

    @Transactional(rollbackFor = Exception.class)
    int DeleteById(List<T> l);

    default T getById(Long Id){
        return getBaseMapper().selectById(Id);
    }
    default T getById(BaseQto mm){
        return getById(mm.getId() );
    }

}
